package com.vint.mi;


/**
 * 字符串丑陋
 */
public class Mi78 {
    private static String solution(String line){
        //没有?
        int index = -1;
        int score = 0;
        while (index < line.length()){
            index = line.indexOf("aa",index+1);
            if(index==-1){
                break;
            }
            score++;
        }
        index =-1;
        while (index < line.length()){
            index = line.indexOf("bb",index+1);
            if(index==-1){
                break;
            }
            score++;
        }

        index = -1;
        while (index < line.length()){
            index = line.indexOf('?', index + 1);
            if(index==-1){
                break;
            }
            if(index==0||index==line.length()-1){
                continue;
            }
            if(line.charAt(index-1)==line.charAt(index+1)){
                continue;
            }
            score ++;
        }
        return score+"";

    }
    public static void main(String[] args) {
        System.out.println(solution("aaaababbba"));
    }
}
